﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using ProjectBase.Core;

using $safeprojectname$;

namespace $safeprojectname$.Validation
{
    public interface IValidator<in TItem> : IService
        where TItem : class
    {
        bool Validate(TItem item, ValidateOn validateOn, IPublishingReporter reporter = null);
        /// <summary>
        /// Returns the (JS) string representation of the UI evaluable validation rules.
        /// (Example: validator.rules["LastName"] = { required: true, minlength: 1,maxlength: 50};)
        /// </summary>
        /// <param name="validationType">The switch which rule type to use. (e.g. "Add", "Update")</param>
        /// <param name="prefix"></param>
        /// <returns>(JS) validation rules</returns>
        string ValidationRulesToString(string validationType, string prefix = null);
    }
}